package com.yyw.dao;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.yyw.bean.Homework;
import com.yyw.bean.Working;

@Mapper
public interface HomeWorkDao {

    int deleteHomework(@Param("id") Long id);

    /**
     * class,title,intro
     *
     * @param homework
     * @return
     */
    int saveHomeWork(Homework homework);

    /**
     * title,intro,id
     *
     * @param homework
     * @return
     */
    int updateHomework(Homework homework);

    Homework getHomeworkById(@Param("id") Long id);

    List<Homework> getHomeworksByClassId(@Param("classid") Long classid);

    /**
     * 获取某学生在某班级的作业情况
     *
     * @return
     */
    List<Homework> getWorkings(@Param("userid") Long userid, @Param("classid") Long classid);

    /**
     * content,id,state,score
     *
     * @param working
     * @return
     */
    int updateWorking(Working working);

    /**
     * classid,userid,homeworkid,content
     *
     * @param working
     * @return
     */
    int saveWorking(Working working);

    Working getWorkingById(@Param("id") Long id);

    /**
     * 获取某一次作业的提交情况
     *
     * @param id
     * @return
     */
    List<Working> getWorkingsByHomeWorkId(@Param("id") Long id);

}
